package com.qf.service;

import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import com.qf.mappper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;

/**
 * @author lyx
 * @date 2022/7/12 15:44
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private RestTemplate restTemplate;
    @Transactional
    @LcnTransaction
    @Override
    public void upMoney() {
        //1.a账户捡500
        userMapper.updataMoney();
        //2.b账户加500
        restTemplate.getForObject("http://localhost:8081/b/test",String.class);
    }
}
